package tw.com.hitevision.whiteboard.android.render;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Shader;
import android.util.Log;

public class PartialEraserPen extends Line {
    private Paint eraserPaint;

    public PartialEraserPen(Context context, float x, float y, float thickness) {
        super(context, x, y, thickness);
        init(context);
    }

    private void init(Context context) {
        int fillColor = 0xFFFFFFFF;
        eraserPaint = new Paint();

        eraserPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
        setColor(fillColor);
        eraserPaint.setColor(fillColor);
        eraserPaint.setAntiAlias(true);
    }

    public void setBitmapShader(Bitmap fillBitmap) {
        BitmapShader bitmapShader = new BitmapShader(fillBitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        eraserPaint.setShader(bitmapShader);
    }

    public Paint getEraserPaint() {
        return eraserPaint;
    }

}
